package com.example.matetest.slice;

import com.example.matetest.ResourceTable;
import com.example.matetest.slice.login.LoginAbilitySlice;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.app.dispatcher.TaskDispatcher;
import ohos.app.dispatcher.task.Revocable;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class MainAbilitySlice extends AbilitySlice {
    private static final String TAG = MainAbilitySlice.class.getSimpleName();
    private static final HiLogLabel logLabel = new HiLogLabel(HiLog.LOG_APP, 0x00001, TAG);

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_main);

        this.toLater();
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    private void toLater(){
        TaskDispatcher uiTaskDispatcher  = getUITaskDispatcher();
        Revocable revocable = uiTaskDispatcher.delayDispatch(new Runnable() {
            @Override
            public void run() {
                present(new LoginAbilitySlice(),new Intent());
            }
        },2000);
    }

   /* private void toGoSearch() {
        Intent intent = new Intent();
        Operation operation = new Intent.OperationBuilder()
                .withUri(Uri.parse("https://www.baidu.com/"))
                .build();
        intent.setOperation(operation);
        startAbility(intent);
    }*/


}
